#!/bin/sh

# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# NOTE: This script is invoked by powerd_suspend each time the system resumes.
# If any changes are made to this script, remember to update powerd_suspend,
# as needed.

# File to store firmware information derived from firmware event log
EVENTLOG_FILE="/var/log/eventlog.txt"

# Set up bios information for chrome://system and userfeedback
# Need to do this before user can request it in Chrome.
# Moved here to keep out of critical boot path

if ! mosys eventlog list > ${EVENTLOG_FILE} 2> /dev/null; then
  # If a sub-command is not available on a platform, mosys will fail with
  # a non-zero exit code (EXIT_FAILURE) and print the help menu. For example,
  # this will happen if a "mosys smbios" sub-command is run on ARM since ARM
  # platforms do not support SMBIOS. If mosys fails, delete the output file to
  # avoid placing non-relevant or confusing output in /var/log.
  echo "unavailable" > ${EVENTLOG_FILE}
fi

